import requests
import re



x=1
for v in range(0,100,10):
    if v==0:
        v=""
    data = {'offset':str(v)}
    headers = {
        'Cookie':'__mta=247233211.1542468242785.1542506394840.1542506434302.16; _lxsdk_s=1672471895f-dfe-748-975%7C%7C24; __mta=247233211.1542468242785.1542468854252.1542504683115.7; _lx_utm=utm_source%3DBaidu%26utm_medium%3Dorganic; _csrf=f44b8302941c69cdf3d01c71953bcfb81fdeed872f3d2a223a14034de1cd3f77; _lxsdk=CC9BD890EA7C11E89ABD195CA6B667DD13B2B006BC114BA8B3067D86D51E0CB1; _lxsdk_cuid=16722457cafc8-038210f084834e-481f3700-13c680-16722457cafc8; uuid=CC9BD890EA7C11E89ABD195CA6B667DD13B2B006BC114BA8B3067D86D51E0CB1; uuid_n_v=v1',
        'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'Accept-Encoding':'gzip, deflate',
        'Upgrade-Insecure-Requests':'1',
        'Host':'maoyan.com',
        'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15',
        'Referer':'http://maoyan.com/board/4',
        'Accept-Language':'zh-cn',
        'Connection':'keep-alive',

    }
    url = "http://maoyan.com/board/4"

    res = requests.get(url,params=data,headers=headers)
    html = res.content.decode("utf-8")
    
    pat = '<img data-src="(.*?)".*?/>.*?<p class="name"><a.*?>(.*?)</a></p>.*?<p class="star">(.*?)</p>.*?<p class="releasetime">(.*?)</p>.*?<p class="score"><i class="integer">(.*?)</i><i class="fraction">(.*?)</i></p>'
    dlist = re.findall(pat,html,re.S)

    
    y=x
    x+=10
    for v in dlist:
        print(str(y)+"\n"+v[1]+"\n"+v[2].strip()+"\n"+v[3]+" 评分:"+v[4]+v[5]+"\n"+"图片"+":"+v[0])
        y+=1




        

        




    




